package org.zhouhe.web.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class Button extends TagSupport {
	private static final long serialVersionUID = 1L;

	private String label;
	private String onclick;
	private String icon;
	
	public int doStartTag() throws JspException {
		SimplePage pageTag = (SimplePage) this.getParent().getParent();
		try {
			pageTag.addButton("<a href='javascript:void(0)' class='easyui-linkbutton' iconCls='"+ icon +"' plain='true' onclick='"+ onclick +"'>"+ label +"</a>");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return SKIP_BODY;
	}

	public int doEndTag() throws JspException {
		return EVAL_PAGE;
	}
	
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public String getOnclick() {
		return onclick;
	}
	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
}
